package gamebackend;

import framework.Point;

public class ShipFlier extends AbstractFlier {

	private Ship my_ship;
	
	@Override
	public void setTarget(final double the_target) {
		super.setTarget(the_target);
		my_ship.moveTo(the_target);
	}
	public void setShip(final Ship the_ship) {
		my_ship = the_ship;
	}
	public void getNextPosition(final Point the_point) {
		my_ship.step(1000 / 30, my_ship.getYPositionChange(1000 / 30));
		the_point.set(my_ship.getXPosition(), my_ship.getYPositionChange(1000 /30));
	}
	@Override
	public boolean isAtTarget() {
		return Math.abs(my_ship.getXPosition() - getTarget()) < 5;
	}
	public void step(final double the_yChange){}
	
	@Override
	public double getPosition() {
		return my_ship.getXPosition();
	}
}
